package com.ftg.learn.day15.interfacexml.question.mapper;

import com.ftg.learn.day15.interfacexml.question.domain.DeptDomain;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * @author 布衣
 */
public interface DeptMapper {

    @Select("select * from dept")
    @Results({
            @Result(column = "deptno", property = "deptId")
            , @Result(column = "dname", property = "dname")
            , @Result(column = "loc", property = "loc")
            , @Result(column = "deptno", property = "emps", many = @Many(fetchType = FetchType.LAZY,select = "com.ftg.learn.day15.interfacexml.question.mapper.EmpMapper.findManyByDeptId"))
    })
    List<DeptDomain> showAll();

}
